package com.yjc.hire.server.thread;

import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;

import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * </p>
 *
 * @author jcyin
 * @since 2025/8/15
 * </p>
 */

@Component
public class MyThread {


    @Bean
    public ThreadPoolExecutor threadPoolExecutor() {
        return  new ThreadPoolExecutor(
                3,
                10,
                30,
                TimeUnit.SECONDS,
                new LinkedBlockingDeque<>(5000),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy()
        );
    }
}
